$(function(argument) {
	
	// var a = xu_new_Data(1477035323);
	// console.log(a);
	var user_id = window.localStorage.getItem("user_id");
	if (user_id == null) {
		window.location.href = "myself.html";
	} else {
		$.ajax({
			url: 'http://www.test.manage.teaweilai.com/Admin/AppTeaCoupon/couponList',
			type: 'POST',
			dataType: 'json',
			data: {
				uid: user_id
			},
			success: function(data) {
				console.log(data);
				var strC = template("myCon", {
					con: data
				});
				$(".container").html(strC);
			}
		})
	}

	// 时间戳转换成日期(template)
	template.helper("new_date",function(a) {
		var a = arguments[0];
		var date = new Date(Number(a)*1000);
		var Y = date.getFullYear() + '-';
		M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
		D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
		h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
		m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
		s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
		// var time_new_xu = Y + M + D + h + m + s;
		var time_new_xu = Y + M + D;
		return time_new_xu;
	})
	// 转换字符串
	template.helper("ToNumber",function(a){
		return Number(a);
	})

	// function toNumberL33(a){
	// 	return Number(a);
	// }
	// var newNum = toNumberL33("12378946");
	// console.log(newNum)
	// console.log(toNumberL33("12378946"))
})